import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("device", { schema: "frog_charge" })
export class Device {
  @PrimaryGeneratedColumn({ type: "int", name: "device_id", unsigned: true })
  deviceId: number;

  @Column("varchar", { name: "device_name", length: 30 })
  deviceName: string;

  @Column("varchar", { name: "cate_1", comment: "分类1", length: 10 })
  cate_1: string;

  @Column("varchar", { name: "cate_2", comment: "分类2", length: 10 })
  cate_2: string;

  @Column("tinyint", {
    name: "port_count",
    comment: "端口数",
    unsigned: true,
    default: () => "'0'",
  })
  portCount: number;

  @Column("int", { name: "merchant_id", unsigned: true, default: () => "'0'" })
  merchantId: number;

  @Column("tinyint", {
    name: "connect_status",
    comment: "在线状态0:离线，1：在线",
    unsigned: true,
    default: () => "'0'",
  })
  connectStatus: number;

  @Column("int", { name: "sim_id", unsigned: true, default: () => "'0'" })
  simId: number;

  @Column("varchar", { name: "sim_card_no", comment: "卡号", length: 20 })
  simCardNo: string;

  @Column("int", {
    name: "strategy_id",
    comment: "策略id",
    unsigned: true,
    default: () => "'0'",
  })
  strategyId: number;

  @Column("varchar", { name: "address", comment: "地址", length: 100 })
  address: string;

  @Column("decimal", {
    name: "longitude",
    precision: 12,
    scale: 8,
    default: () => "'0.00000000'",
  })
  longitude: string;

  @Column("decimal", {
    name: "latitude",
    precision: 12,
    scale: 8,
    default: () => "'0.00000000'",
  })
  latitude: string;

  @Column("int", {
    name: "update_time",
    comment: "更新",
    unsigned: true,
    default: () => "'0'",
  })
  updateTime: number;

  @Column("int", {
    name: "create_time",
    comment: "创建时间",
    unsigned: true,
    default: () => "'0'",
  })
  createTime: number;
}
